import React, { Component } from 'react';
import '../asserts/css/goodsdetail.css'
import qs from 'qs'
import {getGoodsInfo} from '../request/goodsdetail.js'
class Goodsdetail extends Component {
	state={
		getGoodsList:[],
		id:0
	}
UNSAFE_componentWillMount()
{
	let id = qs.parse(this.props.location.search.substr(1));
	this.setState({id})
    getGoodsInfo(id.id).then(res=>{
		if(res.code === 200)
		{
			this.setState({getGoodsList:res.list})
		}
	})
}
	render() {
		let obj = {...this.state.getGoodsList[0]}
		return (
         <>
				<div className="page-title">商品详情</div>
				{/* <!-- 商品详情 --> */}
				
					{<div id="detail">
						<img src={this.$staticUrl + obj.img} alt=""/>
						<div>
							<h3 className="price">&yen;{obj.price}</h3>
							<p>{obj.goodsname}</p>
						</div>
                   </div>
					}
				
					<div className="detail_nav_btm">
						<div className="list">
							<span className="iconfont">&#xe601;</span>
							<p>客服</p>
						</div>
						<div className="list">
							<span className="iconfont">&#xe61a;</span>
							<p>店铺</p>
						</div>
						<div className="list">
							<span className="iconfont">&#xe653;</span>
							<p>购物车<i className="num"></i></p>
						</div>
						<input type="button" className="join_sp" name="" id="" value="加入购物车" />
						<input type="button" className="buy_now" name="" id="" value="立即购买" />
					</div>
         </>
        )
    }
}

export default Goodsdetail